using AutoMapper;
using SapaFinance.DTO;
using SapaFinance.Domain.Model;

namespace SapaFinance.OOMap.Helpers
{
    public class BankToBankDTOConvert : TypeConverter<Bank, BankDTO>
    {

        protected override BankDTO ConvertCore(Bank entity)
        {
            var dto = new BankDTO();
            if (entity != null)
            {
                dto.UID = entity.UID;
                dto.Name = entity.Name;
                dto.Address = entity.Address;
                dto.CorrespondentAccount = entity.CorrespondentAccount;
                dto.Bin = entity.Bin;
                dto.City = entity.City;
                dto.Swift = entity.Swift;
                dto.IsHidden = entity.IsHidden;
                dto.Changed = entity.ChangedBy.DateTime;
                dto.ChangedBy = entity.ChangedBy.User.FullName;
                dto.Created = entity.CreatedBy.DateTime;
                dto.CreatedBy = entity.CreatedBy.User.FullName;
            }
            return dto;
        }
    }
}